URL="http://localhost:8601/"
$(function() {
    search111();
    layui.use('flow', function() {
        var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
        var flow = layui.flow;
        flow.load({
            elem: '#demo' //指定列表容器
            ,
            done: function(page, next) { //到达临界点（默认滚动触发），触发下一页
                var lis = [];
                $.ajax({
                    type: "get",
                    url: URL+"Article/listArticleAll",
                    data: {
                        page: page
                    },
                    dataType: "json",
                    success: function(res) {
                        layui.each(res.data, function(index, item) {
                            lis.push('<div class="row"><div class="news-list" v-for="la in listArticle"><div class="news-info" v-text=""><dl><dt> <a href="content.html?index='+item.article_id+'">'+item.article_title+' </a> </dt><dd><span class="name"><a href="" title="" rel="author">'+item.user.user_nickname+'</a></span> <span class="identity"></span><span class="time">'+item.article_publishDate+' </span></dd><dd class="text">'+item.article_summary+'</dd></dl><div class="news_bot col-sm-7 col-md-8"> <span class="tags visible-lg visible-md"> <a href="">本站</a> <a href="">'+item.article_kind.kind_name+'</a></span> <span class="look"> 共 <strong>'+item.article_pageView+'</strong> 人围观，有<strong>'+item.article_artileClickSum+' </strong> 人点赞 </span> </div></div></div></div>');
                        });
                        var pages = Math.ceil(res.count / 10);
                        next(lis.join(''), page < pages);
                    }
                });
            }
        });
    });
});
function search111() {
    document.getElementById("demo").innerHTML="";
    layui.use('flow', function() {
        var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
        var flow = layui.flow;
        var name = $("#name").val();
        flow.load({
            elem: '#demo' //指定列表容器
            ,
            done: function(page, next) { //到达临界点（默认滚动触发），触发下一页
                var lis = [];
                $.ajax({
                    type: "get",
                    url: URL+"Article/listArticleAll?name="+name,
                    data: {
                        page: page,
                    },
                    dataType: "json",
                    success: function(res) {
                        layui.each(res.data, function(index, item) {
                            lis.push('<div class="row"><div class="news-list" v-for="la in listArticle"><div class="news-info col-xs-7 col-sm-7 col-md-9" v-text=""><dl><dt> <a href="content.html?index='+item.article_id+'">'+item.article_title+' </a> </dt><dd><span class="name"><a href="" title="" rel="author">'+item.user.user_nickname+'</a></span> <span class="identity"></span><span class="time">'+item.article_publishDate+' </span></dd><dd class="text">'+item.article_summary+'</dd></dl><div class="news_bot col-sm-7 col-md-8"> <span class="tags visible-lg visible-md"> <a href="">本站</a> <a href="">'+item.article_kind.kind_name+'</a></span> <span class="look"> 共 <strong>'+item.article_pageView+'</strong> 人围观，有<strong>'+item.article_artileClickSum+' </strong> 人点赞 </span> </div></div></div></div>');
                        });
                        var pages = Math.ceil(res.count / 10);
                        next(lis.join(''), page < pages);
                    }
                });
            }
        });
    });
}
$(function() {
    //添加第一个样式
    $("li:first").addClass("bg");

    //鼠标移动  adver
    $(".adver").mouseover(function() {
        $(".arrowLeft").show();
        $(".arrowRight").show();
    }).
    mouseout(function() {
        $(".arrowLeft").hide();
        $(".arrowRight").hide();
    });
    var imgs = new Array();
    var title = new Array();
    var src = new Array();
    $.ajax({
        url: URL+'adver/getAdvAll', //地址
        dataType: 'json', //数据类型
        type: 'GET', //类型
        //请求成功
        success: function(res) {
            console.log(res);
            var strhtml = '';
            $.each(res, function(index, item) {
                index++;
                strhtml += '<li class="llli">' + index + '</li>'
                title.push(item.advertising_title)
                imgs.push(item.advertising_img);
                src.push(item.advertising_url);
            });
            $("#demo2").html(strhtml);
        }
    });
    //图片数组
    /* var imgs = new Array("1949101.jpg", "1949101.jpg", "1949101.jpg", "1949101.jpg", "1949101.jpg", "1949101.jpg"); */

    //统计个数
    var count = 0;
    //单击右 边的>
    $(".arrowRight").click(function() {
        //判断
        if (count == imgs.length - 1) {
            count = 0;
        } else {
            count++; //累计
        }
        $(".adver").css("background", "url(images/" + imgs[count] + ")"); //添加图片
        $("#title").html(title[count]);
        $("#title").attr("href", src[count]);
        $('.llli:eq(' + count + ')').addClass("bg"); //添加圆圈背景
        $('.llli:eq(' + count + ')').siblings().removeClass("bg"); //删除前面的圆圈背景

    });

    //单击左边的>
    $(".arrowLeft").click(function() {
        //判断
        if (count == 0) {
            count = imgs.length - 1;
        } else {
            count--; //累计
        }
        $(".adver").css("background", "url(images/" + imgs[count] + ")"); //添加图片
        $("#title").html(title[count]);
        $("#title").attr("href", src[count]);
        $('.llli:eq(' + count + ')').addClass("bg"); //添加圆圈背景
        $('.llli:eq(' + count + ')').siblings().removeClass("bg"); //删除前面的圆圈背景

    });
    ////////////////////图片自动滚动/////////////////////////////////
    //开启定时器
    var timer = setInterval(function() {
        if (count == imgs.length - 1) {
            count = 0; //回到起点0
        } else {
            count++; //累计
        }
        $(".adver").css("background", "url(images/" + imgs[count] + ")"); //添加图片
        $("#title").html(title[count]);
        $("#title").attr("href", src[count]);

        $('.llli:eq(' + count + ')').addClass("bg"); //添加圆圈背景
        $('.llli:eq(' + count + ')').siblings().removeClass("bg"); //删除前面的圆圈背景
    }, 3000);

    //鼠标移入、移出
    $(".adver").hover(function() {
        clearInterval(timer); //鼠标移入,定时器关闭
    }, function() {
        //鼠标移出,开启定时器
        timer = setInterval(function() {
            if (count == imgs.length - 1) {
                count = 0; //回到起点0
            } else {
                count++; //累计
            }
            $(".adver").css("background", "url(images/" + imgs[count] + ")"); //添加图片
            $("#title").html(title[count]);
            $("#title").attr("href", src[count]);
            $('.llli:eq(' + count + ')').addClass("bg"); //添加圆圈背景
            $('.llli:eq(' + count + ')').siblings().removeClass("bg"); //删除前面的圆圈背景
        }, 3000);
    });
});
function close() {
    document.getElementById('dd').style.display = "none";
}
